﻿var builder = WebApplication.CreateBuilder(args);

// 配置Kestrel选项
builder.WebHost.ConfigureKestrel((context, options) =>
{
    //配置Kestrel Host。Kestrel的默认监听端口是http5000、https5001。
    options.SetHost();
});

////项目中需要在startup启动类中使用DbContext对数据库做一些操作的例外设置
////以解决错误：“Cannot resolve scoped service 'XXX' from root provider”
//builder.WebHost.UseDefaultServiceProvider(options => { options.ValidateScopes = false; });

//配置启动类
Startup startup = new();
startup.ConfigureServices(builder.Services);

var app = builder.Build();
startup.Configure(app);

//运行程序
app.Run();
